package com.hefeng.unit.controller;


import com.alibaba.fastjson.JSONObject;
import com.hefeng.common.core.web.domain.AjaxResult;
import com.hefeng.unit.domain.GyOrderDistribution;
import com.hefeng.unit.domain.GyUserOrder;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/order/detail")
public class OrderDetail {


@Autowired
private RestTemplate restTemplate;

    /**
     * 工单详情
     * @param
     * @return
     */
    @RequestMapping(value = "/invoke", produces = "application/json;charset=UTF-8")
    @ApiOperation("工单详情")
    public AjaxResult login(@RequestBody GyOrderDistribution gyOrderDistribution){
        String workId=gyOrderDistribution.getWorkId();
        String url="http://127.0.0.1:9204/wx/result/getDeviceList";
        Map<String, Object> map = new HashMap<>();
        map.put("workId", workId);
        //HttpEntity
        HttpEntity<?> request = new HttpEntity<>(map);
        //发送请求
        ResponseEntity<JSONObject> obj = restTemplate.postForEntity(url, request, JSONObject.class);
        return AjaxResult.success(obj);

    }
}
